package com.weiaibenpao.demo.chislim.ui.activity.me;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.widget.TextView;

import com.weiaibenpao.demo.chislim.R;
import com.weiaibenpao.demo.chislim.base.BaseActivity;

import butterknife.BindView;
import butterknife.OnClick;

public class AboutActivity extends BaseActivity {


    @BindView(R.id.version_code)
    TextView versionCode;

    @Override
    public int setLayoutResourceID() {
        return R.layout.activity_about;
    }

    @Override
    public void init(Bundle savedInstanceState) {
        getVersion();
    }

    public static void startSelf(Context context) {

        context.startActivity(new Intent(context, AboutActivity.class));
    }

    private void getVersion() {
        PackageManager manager = this.getPackageManager();
        try {
            PackageInfo packageInfo = manager.getPackageInfo(this.getPackageName(), 0);
            versionCode.setText("版本号" + packageInfo.versionName);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }

    }


    @OnClick(R.id.left_image)
    public void onViewClicked() {
        finish();
    }
}
